/* 
 * File:   Menu.cpp
 * Author: amouro-m
 * 
 * Created on 30 mai 2010, 14:04
 */

#include "Menu.h"

#include "FractalWindow.h"

Menu::Menu(Frame* frame, QWidget* parent):
QMenuBar(parent),
_frame(frame)
{
    /*
     * Menu des fractales
     */
    QMenu* menuFractal = new QMenu("Fractal");
    action_new_window = new QAction(tr("&New"), this);
    connect(action_new_window, SIGNAL(triggered()), this, SLOT(new_window()));
    menuFractal->addAction(action_new_window);

    fractal_mendel = new QAction(tr("&Mendel"), this);
    connect(fractal_mendel, SIGNAL(triggered()), this, SLOT(set_fractal_mendel()));
    menuFractal->addAction(fractal_mendel);

    fractal_julia = new QAction(tr("&Juila"), this);
    connect(fractal_julia, SIGNAL(triggered()), this, SLOT(set_fractal_julia()));
    menuFractal->addAction(fractal_julia);

    bruit_perlin = new QAction(tr("&Bruit de Perlin"), this);
    connect(bruit_perlin, SIGNAL(triggered()), this, SLOT(set_bruitperlin()));
    menuFractal->addAction(bruit_perlin);

    /*
     * Menu de printers
     */
    QMenu* menuPrinter = new QMenu("Affichage");
    fractal_printer_normal = new QAction(tr("&Normal"), this);
    connect(fractal_printer_normal, SIGNAL(triggered()), this, SLOT(set_printer_normal()));
    menuPrinter->addAction(fractal_printer_normal);

    fractal_printer_inversex = new QAction(tr("&Inverse x"), this);
    connect(fractal_printer_inversex, SIGNAL(triggered()), this, SLOT(set_printer_inversex()));
    menuPrinter->addAction(fractal_printer_inversex);

    fractal_printer_inversey = new QAction(tr("&Inverse y"), this);
    connect(fractal_printer_inversey, SIGNAL(triggered()), this, SLOT(set_printer_inversey()));
    menuPrinter->addAction(fractal_printer_inversey);

    fractal_printer_inversexy = new QAction(tr("&Inverse x et y"), this);
    connect(fractal_printer_inversexy, SIGNAL(triggered()), this, SLOT(set_printer_inversexy()));
    menuPrinter->addAction(fractal_printer_inversexy);

    /*
     * Menu des filtres
     */
    QMenu* menuFilter = new QMenu("Filtres");
    filtre_NB = new QAction(tr("&Niveau de gris"), this);
    connect(filtre_NB, SIGNAL(triggered()), this, SLOT(set_filtre_NB()));
    menuFilter->addAction(filtre_NB);

    filtre_Red = new QAction(tr("&Composante rouge"), this);
    connect(filtre_Red, SIGNAL(triggered()), this, SLOT(set_filtre_Red()));
    menuFilter->addAction(filtre_Red);

    filtre_Green = new QAction(tr("&Composante verte"), this);
    connect(filtre_Green, SIGNAL(triggered()), this, SLOT(set_filtre_Green()));
    menuFilter->addAction(filtre_Green);

    filtre_Blue = new QAction(tr("&Composante bleue"), this);
    connect(filtre_Blue, SIGNAL(triggered()), this, SLOT(set_filtre_Blue()));
    menuFilter->addAction(filtre_Blue);

    filtre_Flou = new QAction(tr("&Filtre flou"), this);
    connect(filtre_Flou, SIGNAL(triggered()), this, SLOT(set_filtre_Flou()));
    menuFilter->addAction(filtre_Flou);

    this->addMenu(menuFractal);
    this->addMenu(menuPrinter);
    this->addMenu(menuFilter);
    this->addAction("Exit", parent, SLOT(close()));
}


void
Menu::new_window()
{
    FractalWindow* fractal_window = new FractalWindow(600,480);
    fractal_window->show();
}

void
Menu::set_fractal_julia()
{
    _frame->set_fractal_julia();
}

void
Menu::set_fractal_mendel()
{
    _frame->set_fractal_mendel();
}

void
Menu::set_bruitperlin()
{
    _frame->set_bruitdeperlin();
}


void
Menu::set_printer_normal()
{
    _frame->set_printer_normal();
}

void
Menu::set_printer_inversex()
{
    _frame->set_printer_inversex();
}

void
Menu::set_printer_inversey()
{
    _frame->set_printer_inversey();
}

void
Menu::set_printer_inversexy()
{
    _frame->set_printer_inversexy();
}

void
Menu::set_filtre_NB()
{
    _frame->set_filtre_NB();
}

void
Menu::set_filtre_Red()
{
    _frame->set_filtre_Red();
}

void
Menu::set_filtre_Green()
{
    _frame->set_filtre_Green();
}

void
Menu::set_filtre_Blue()
{
    _frame->set_filtre_Blue();
}


void
Menu::set_filtre_Flou()
{
    _frame->set_filtre_Flou();
}

Menu::~Menu() {}